package com.maxatime.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.maxatime.dao.StudentBasicInfoMapper;
import com.maxatime.dao.StudentDormitoryRelationMapper;
import com.maxatime.pojo.entity.StudentBasicInfo;
import com.maxatime.pojo.entity.StudentDormitoryRelation;
import com.maxatime.service.StudentDormitoryRelationSerivce;
@Service
public class StudentDormitoryRelationServiceImpl implements StudentDormitoryRelationSerivce{
	
	@Autowired
	StudentDormitoryRelationMapper studentDormitoryRelationMapper;
	
	@Autowired
	StudentBasicInfoMapper studentBasicInfoMapper;

	@Override
	public int deleteByPrimaryKey(String studentId) {
		// TODO Auto-generated method stub
		studentDormitoryRelationMapper.deleteByPrimaryKey(studentId);
		return 0;
	}

	@Override
	public int insert(StudentDormitoryRelation record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int insertSelective(StudentDormitoryRelation record) {
		// TODO Auto-generated method stub
		StudentDormitoryRelation studentDormitoryRelation = new StudentDormitoryRelation();
		BeanUtils.copyProperties(record, studentDormitoryRelation);
		Date d = new Date();
		studentDormitoryRelation.setCreateTime(d);
		studentDormitoryRelation.setUpdateTime(d);
		studentDormitoryRelation.setDeleteFlag("0");
		studentDormitoryRelationMapper.insertSelective(studentDormitoryRelation);
		return 0;
	}

	@Override
	public StudentDormitoryRelation selectByPrimaryKey(Integer pkId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateByPrimaryKeySelective(StudentDormitoryRelation record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updateByPrimaryKey(StudentDormitoryRelation record) {
		// TODO Auto-generated method stub
		return 0;
	}
	//添加学生模态框查询
	@Override
	public List<StudentDormitoryRelation> listData(String dormitoryId) {
		// TODO Auto-generated method stub
		List<StudentDormitoryRelation> list = studentDormitoryRelationMapper.listData(dormitoryId);
		return list;
	}
	//学生查询
	@Override
	public List<StudentBasicInfo> listData1(StudentBasicInfo studentBasicInfo) {
		// TODO Auto-generated method stub
		List<StudentBasicInfo> list = studentBasicInfoMapper.selectByPrimaryKey2(studentBasicInfo);
		return list;
	}

	@Override
	public StudentBasicInfo listData2(String studentId) {
		// TODO Auto-generated method stub
		StudentBasicInfo list = studentBasicInfoMapper.selectByPrimaryKey3(studentId);
		return list;
	}

}
